﻿//
// *************************************************************************************
// WP-Framework
// 
// Developed by
// Lukas Kretschmar (lkretschmar.dev@bluewin.ch)
//
// Switzerland, Copyright (c) 2013 lkretschmar
// This content is released under the MIT License (http://opensource.org/licenses/MIT).
//     
// *************************************************************************************
//
//


using Microsoft.VisualStudio.TestTools.UnitTesting;
using KretschIT.WP_Fx.EasyMoq.Generator.Configurations;
using KretschIT.WP_Fx.EasyMoq.Generator.Tests.Helpers.Objects;
using System.Linq;

namespace KretschIT.WP_Fx.EasyMoq.Generator.Tests.Configurations
{
    [TestClass]
    public class EasyMoqConfigTest
    {
        private EasyMoqConfig config;

        [TestInitialize]
        public void Init()
        {
            this.config = new EasyMoqConfig();
        }

        [TestMethod]
        public void Test_TargetNamespace()
        {
            this.config.TargetNamespace = "Test";
            Assert.AreEqual("Test", this.config.TargetNamespace);
        }

        [TestMethod]
        public void Test_DefaultTargetNamespace()
        {
            Assert.AreEqual("EasyMoq.Mocking", this.config.TargetNamespace);
        }

        [TestMethod]
        public void Test_InvalidTargetNamespaces()
        {
            this.config.TargetNamespace = string.Empty;
            Assert.AreEqual("EasyMoq.Mocking", this.config.TargetNamespace);

            this.config.TargetNamespace = " ";
            Assert.AreEqual("EasyMoq.Mocking", this.config.TargetNamespace);

            this.config.TargetNamespace = null;
            Assert.AreEqual("EasyMoq.Mocking", this.config.TargetNamespace);
        }

        [TestMethod]
        public void Test_SimpleMockType()
        {
            this.config.CreateMockFor<ITestObject>();
            Assert.AreEqual(1, this.config.MockTypes.Count());
        }

        [TestMethod]
        public void Test_GenericMockType()
        {
            this.config.CreateMockFor<ITestSimpleGenericObject<string>>();
            Assert.AreEqual(1, this.config.MockTypes.Count());
        }
    }
}
